﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>智慧公社-设置</title>

    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.css" rel="stylesheet" />
    <link href="__PUBLIC__/css/index.css" rel="stylesheet" />

    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/headroom.js"></script>
    <script src="__PUBLIC__/js/jquery.snippet.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/jquery.pin.min.js"></script>
    <script src="__PUBLIC__/js/sco.ajax.js"></script>
    <script src="__PUBLIC__/js/sco.modal.js"></script>
     <script src="__PUBLIC__/js/index.js"></script>
    <script src="__PUBLIC__/js/sco.confirm.js"></script>
    <script src="__PUBLIC__/js/ajaxfileupload.js"></script>
    <script>
	</script>
    <!--<style>
    *{border: 1px solid rgb(250,0,255);}
    </style>-->
</head>
<body>

    <!-- 头部导航开始 -->
  <include file="Index/title" />
    <!-- 主体信息开始 -->

    <div id='contents' class="container setup">
        <div class="row setup-cont">
            <div class="col-xs-3 setup-left">
                <div class="setup-top">
                    <div class="setup-user">
                        <img id="avatar" src="{$uCont['user_img']}" width="60" height="60"
							class="img-circle border-3  cursor" style="cursor:pointer;"/> <!--<img id="avatarLo"
							src="__PUBLIC__/images/Load.gif" width="16"
							style="display: none; position: absolute; z-index: 2; left: 65px; top: 100px;" />-->
                        <span>{$uCont['user_name']}</span><span style="display:block;width:20px; height:20px; margin-top:-38px;"><i id="avatarLo" class='fa fa-spinner fa-spin fa-large fa-lg' style="display:none; cursor:pointer;"></i></span>
                    </div>
                    <div class="setup-user" style="padding:20px">
                        个人设置
                    </div>
                </div>
            </div>
            <div class="col-xs-9 setup-right">
                <div>
                    <h3>基本信息</h3>
                    <div style="margin:10px auto"><i class=" icon-arrow-left">←点击头像可修改</i></div>
                    <div>
                        <textarea class="form-control" rows="3" id="text"  placeholder="成就&宣言">{$uCont['user_text']}</textarea>
                    </div>
                <div style="text-align:right; margin-top:10px;">
                    <button type="button" class="btn bc">保存</button>
                </div>
                </div>
                <div>
                    <h3>修改标签</h3>
                    <div>
                        <div class="tags">
                            <div>擅长：</div>
                            <div class="setup-tag" >
                            <span id="sav">
                                 <foreach name="scTag" item="scVo"> 
                                   <span>
                                    <span class="btn tag tag-{:rand(1,6)}">{$scVo['tag_content']}</span>
                                 </span> 
                                </foreach>
                              </span>
                                  <a data-trigger="modal" data-title="Modal title" href="fuck.html?type=2"><span class="fa fa-plus"></span></a>
                               
                            </div>
                        </div>
                        <div class="tags">
                            <div>兴趣：</div>
                            <div class="setup-tag">
                            <b id="fav">
                                 <foreach name="xqTag" item="xqVo"> 
                                   <span>
                                    <span class="btn tag tag-{:rand(1,6)}">{$xqVo['tag_content']}</span>
                                 </span> 
                                </foreach>
                              </b>
                                <a data-trigger="modal" data-title="Modal title" href="fuck.html?type=1"><span class="fa fa-plus"></span></a>
                            </div>

                        </div>
                    </div>
                </div>
                <div>
                    <h3>账户信息</h3>
                    <div style="margin:10px auto;padding-left:30px;">修改您当前的密码：<a onclick="$('#editpw').slideDown();">修改</a></div>
                    <div style="width:300px;display:none;" id="editpw">
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputEmail2">原密码</label>
                            <input type="password" class="form-control" id="password" placeholder="请输入原密码">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputEmail2">新密码</label>
                            <input type="password" class="form-control" id="password" placeholder="请输入新密码">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputPassword2">重复密码</label>
                            <input type="password" class="form-control" id="repassword" placeholder="请在在输入一次">
                        </div>
                    </div>
                </div>
                <div style="text-align:right">
                    <button type="button" class="btn btn-info">保存</button>
                </div>
            </div>
        </div>

    </div> <!-- 主体信息结束 -->

    <footer>
        
        </footer>
         <form id="uploadForm" action="{:U('Index/upload')}"
		enctype="multipart/form-data" method="post">
		<input type="file" id="file" name="file" style="width: 0px; height: 0px; float: right; border: none;" />
	</form>
            <script type="text/javascript">
			function upload() {
			if ($("#file").val() == "")
				setTimeout("upload()", 500);
			else {
                 $("#avatarLo").show();
				$("#uploadForm").submit();
				//upload and refrush
			}
		}
		$(document).ready(function() {

			$("#avatar").click(function() {

				$("#file").val("");
				$("#file").click();
				upload();

			});

			$('#uploadForm').submit(function() {
				$.ajaxFileUpload({
					url : "{:U('Index/upload')}",
					type : "post",
					secureuri : false,
					fileElementId : 'file',
					dataType : "JSON",
					beforeSend:function()
					{
						
						$("#avatarLo").show();
					},
					complete:function()
					{   
						$("#avatarLo").hide();
					},	
					success : function(msg) {
						$("#avatarLo").hide();
						$('#avatar').attr('src',window.location.protocol +'//' + window.location.host + "/Uploads/" + msg);
						$('#titleImg').attr('src',window.location.protocol +'//' + window.location.host + "/Uploads/" + msg);
					},
					error: function (data, status, e)
					{
						alert("失败!");
					}
				});
				return false; //阻止表单的默认提交事件 
			});
		});
			
                jQuery(function ($) {
                    $(document).ready(function () {
                        var header = new Headroom(document.querySelector(".navbar"), {
                            tolerance: 0,
                            offset: 0,
                            classes: {
                                initial: "animated",
                                pinned: "slideDown",
                                unpinned: "slideUp"
                            }
                        });
                        header.init();
                        $('button[data-loading-text]').click(function () {
                            var btn = $(this).button('loading');
                            setTimeout(function () {
                                btn.button('reset');
                            }, 2000);
                        });
                        $('.card').mouseover(function () {
                            $(this).find('.close').toggleClass("hidden");
                        });
                        $('.card').mouseout(function () {
                            $(this).find('.close').toggleClass("hidden");
                        });
                        $('[data-dismiss="fuck"]').click(function () {
                            $(this).closest('.card').fadeOut(1000);
                        });
                        //var messcont = $("#myTabContent").find(".mess-close").size();
                        //$(".mess-nord").text(messcont);

                       /* $('.fake-textarea').click(function () {
                            $('.fake-textarea').hide();
                            $('#woqu').fadeIn();
                            $("#editor").focus();
                        });*/

                    });
				$('.bc').click(function(){
					var text=$('#text').val();
					$.ajax({
						url:'__URL__/updataText',
			           type:'POST',
					   data:{'text':text},
					   success: function(data){
						  if(data=='true'){
							  alert("修改成功");
							  }
						   }
						
						});
					});

                });
            </script>

</body>
</html>